#pragma once
#include <core/strings/BaseString.h>
#include <string>
#include <map>
#include <mutex>
#include "bondlib.h"

using namespace std;
typedef qb::base::KeyString KeyString;
typedef struct _tag_QBFINANCIALCOMPANYINFO{
	//char m_CompanyID[33];			//机构ID
	//std::string  m_CompanyCode;		//机构代码
	std::string  m_Name;			//简称
	//std::string  m_Full_Name;		//全称
	//std::string  m_Name_En;			//英文简称
	//std::string  m_Full_Name_En;	//英文全称
	//std::string  m_City_Name;		//城市
	_tag_QBFINANCIALCOMPANYINFO(){
		Clear();
	}
	void Clear(){
		//memset(m_CompanyID,0,sizeof(m_CompanyID));
		//m_CompanyCode = "";
		m_Name = "";
		//m_Full_Name = "";
		//m_Name_En = "";
		//m_Full_Name_En = "";
		//m_City_Name = "";
	};
}QBFINANCIALCOMPANYINFO;

class S_BONDLIB_EXPORT CSSFinancialCompanyInfo
{
	typedef std::string KeyType;
	typedef std::map<KeyType, QBFINANCIALCOMPANYINFO> CompanyMap;
public:
	CompanyMap m_map; // key = CompanyID, value = QBFINANCIALCOMPANYINFO
	std::mutex m_mutex;
public:
	static CSSFinancialCompanyInfo& instance();
	void Clear();
	int	 Size();
	void Add(const char* companyId,const QBFINANCIALCOMPANYINFO &info);
	void Remove(const char* companyId);
	void Lock();
	void Unlock();
public://调试用
	void DumpStatus(int mode = 0)const;
private:
	CSSFinancialCompanyInfo(void);
	~CSSFinancialCompanyInfo(void);
};
